let t = require;
let e = module;
let o = e.exports;
o.default = e.exports;

('use strict');
console.log('start');
var _n21,
  i =
    (this && this.__extends) ||
    ((_n21 = function n(t, e) {
      return (_n21 =
        Object.setPrototypeOf ||
        ({
          __proto__: []
        } instanceof Array &&
          function (t, e) {
            t.__proto__ = e;
          }) ||
        function (t, e) {
          for (var o in e) {
            Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
          }
        })(t, e);
    }),
    function (t, e) {
      function o() {
        this.constructor = t;
      }
      _n21(t, e),
        (t.prototype =
          null === e
            ? Object.create(e)
            : ((o.prototype = e.prototype), new o()));
    });
Object.defineProperty(o, '__esModule', {
  value: !0
});
var r = t('AbsSDK'),
  a = t('MD5'),
  s = t('SoundMrg'),
  c = t('TimeMrg'),
  l = t('Logger'),
  u = t('NetUtils'),
  h = t('App'),
  p = t('GeneralTips'),
  f = t('UmaSdkHelper'),
  d = t('LangCfg'),
  g = (function (t) {
    function e(e, o, n, i, r) {
      void 0 === n && (n = ''),
        void 0 === i && (i = 0),
        void 0 === r && (r = '');
      var a = t.call(this, e, o, n, i, r) || this;
      return (
        (a._shareType = 0),
        (a._videoType = 0),
        (a._shareTime = 0),
        a.initDefaultData(),
        a.initWX(),
        a
      );
    }
    return (
      i(e, t),
      (e.prototype.initWX = function () {
        if ('undefined' != typeof wx) {
          l.Logger.log('>>>>> initWX'),
            wx.showShareMenu({
              withShareTicket: !0
            });
          var t = this;
          wx.onShareAppMessage(function () {
            return {
              title: t.shareTitle,
              query: '',
              imageUrlId: t.shareImageId,
              imageUrl: t.shareImageUrl
            };
          }),
            this.checkVideoInit();
        }
      }),
      (e.prototype.login = function (t) {
        if ((void 0 === t && (t = null), 'undefined' != typeof wx)) {
          var e = this;
          l.Logger.log('开始登录'),
            wx.login({
              success: function success(t) {
                if (t.code) {
                  var o = {
                    gid: e.appCode,
                    sdk: e.sdkType,
                    jsonstr: JSON.stringify({
                      js_code: t.code
                    })
                  };
                  (o.sign = a.default.hex_md5(
                    (
                      o.gid +
                      o.sdk.toString() +
                      o.jsonstr +
                      h.App.CLIENT_KEY
                    ).toLowerCase()
                  )),
                    l.Logger.log(o),
                    u.default.POST(
                      h.App.getLoginUrl(),
                      o,
                      function (t) {
                        l.Logger.log(t),
                          t && t.data && t.data.json && t.data.json.openid
                            ? ((e._uid = t.data.json.openid),
                              f.default.sendOpenId(e._uid),
                              e.startLogin())
                            : p.GeneralTips.show(d.LangCfg.ins.getContent(1e3));
                      },
                      this
                    );
                } else p.GeneralTips.show(d.LangCfg.ins.getContent(1e3));
              },
              fail: function fail(t) {
                l.Logger.log(t),
                  p.GeneralTips.show(d.LangCfg.ins.getContent(1e3));
              }
            });
        } else this.startLogin();
      }),
      (e.prototype.logout = function () {}),
      (e.prototype.postMessage = function (t) {
        for (var e = [], o = 1; o < arguments.length; o++) {
          e[o - 1] = arguments[o];
        }
        'undefined' != typeof wx &&
          (null == this._openDataContext &&
            (this._openDataContext = wx.getOpenDataContext()),
          this._openDataContext &&
            this._openDataContext.postMessage({
              message: t,
              args: e
            }));
      }),
      (e.prototype.share = function (t, e, o) {
        if (
          (void 0 === t && (t = null),
          void 0 === e && (e = null),
          void 0 === o && (o = 0),
          'undefined' != typeof wx && !(this._shareTime > 0))
        ) {
          (this._shareTime = c.TimeMrg.serverTime), (this._shareType = o);
          var n = '',
            i = wx.getLaunchOptionsSync();
          i && (n = JSON.stringify(i.query)),
            wx.shareAppMessage({
              title: this.shareTitle,
              query: n,
              imageUrlId: this.shareImageId,
              imageUrl: this.shareImageUrl
            }),
            t && e
              ? ((this._shareCallBack = t), (this._shareTarget = e))
              : (this._shareTime = 0);
        }
      }),
      (e.prototype.showVideoAd = function (t, e, o) {
        if (
          (void 0 === t && (t = null),
          void 0 === e && (e = null),
          void 0 === o && (o = 0),
          'undefined' != typeof wx)
        )
          if (this._adOpen) {
            (this._videoType = o), (this._callback = t), (this._target = e);
            var n = this;
            s.SoundMrg.pauseMusic(),
              this._videoAd.show().catch(function () {
                n._videoAd
                  .load()
                  .then(function () {
                    return n._videoAd.show();
                  })
                  .catch(function () {
                    l.Logger.log('激励视频 广告显示失败');
                  });
              });
          } else this.share(t, e);
      }),
      (e.prototype.videoAdBuy = function (t, e, o, n) {
        void 0 === o && (o = null),
          void 0 === n && (n = null),
          this.showVideoAd(o, n);
      }),
      (e.prototype.hideVideoAd = function () {}),
      (e.prototype.checkVideoInit = function () {
        var t = this,
          e = this;
        this._adOpen &&
          null == this._videoAd &&
          ((this._videoAd = wx.createRewardedVideoAd({
            adUnitId: e.adUnitId
          })),
          this._videoAd.onClose(function (o) {
            s.SoundMrg.resumeMusic(),
              ((o && o.isEnded) || null == o) &&
                e.showVideoAdComplete(e._callback, e._target),
              (t._videoType = 0);
          }),
          this._videoAd.onError(function (t) {
            (e._videoType = 0), l.Logger.log('videoAd onError', t);
          }));
      }),
      (e.prototype.showVideoAdComplete = function (t, e) {
        void 0 === t && (t = null),
          void 0 === e && (e = null),
          l.Logger.log('--------showVideoAdComplete---------'),
          t && e && t.call(e);
      }),
      (e.prototype.umEvent = function () {}),
      e
    );
  })(r.default);
(o.default = g), console.log('end');
module.exports = e.exports;
